









PLAYER2:
	CONTROL_PLAYER(BW_OBJ_PLAYER,"w","s","a","d","SPACE")
	CONTROL_PLAYER(BW_OBJ_PLAYER2,"UP","DOWN","LEFT","RIGHT","ENTER")
return

CONTROL_PLAYER(PLAYER_OBJ,UP,DOWN,LEFT,RIGHT,SHOOT){
global	
/*
	If PLAYER_OBJ not in %BW_OBJ_PLAYER%,%BW_OBJ_PLAYER2%
		return
*/
;###################################################################################
If(GetKeyState(DOWN,"P")){
	If(!%PLAYER_OBJ%_WALK_DOWN){
	
		BW_ANIMATION_REMOVE_OBJECT(PLAYER_OBJ)
		
		If(%PLAYER_OBJ%_DIRECTION = "DOWN"){
			If(%PLAYER_OBJ%_SHOOT){
				BW_ANIAMTIONLIST_ADD("FAYT_WALK_DOWN_SHOOT",PLAYER_OBJ,false)
			}else{
				BW_ANIAMTIONLIST_ADD("FAYT_WALK_DOWN",PLAYER_OBJ,false)
			}
			PHY_OBJECT_UPDATE(PLAYER_OBJ, "",  "",  "",  "","",vector)
			%PLAYER_OBJ%_WALK_DOWN	:= true
		}else{
			%PLAYER_OBJ%_DIRECTION    := "DOWN"
			BLOCKWORLD_OBJECT_TEXTURE_SET(PLAYER_OBJ, BW_TEXTURENAME_Fayt_Leingod_D_01)
		}	
	}
}else{
	  If(%PLAYER_OBJ%_WALK_DOWN){
		%PLAYER_OBJ%_WALK_DOWN	:= false
		PHY_OBJECT_UPDATE(PLAYER_OBJ, "",  "",  "",  "","",0)
		BW_ANIMATION_REMOVE_OBJECT(PLAYER_OBJ)
		BLOCKWORLD_OBJECT_TEXTURE_SET(PLAYER_OBJ, BW_TEXTURENAME_Fayt_Leingod_D_01)   	
	  }
}
;###################################################################################

;###################################################################################
If(GetKeyState(UP,"P")){
	If(!%PLAYER_OBJ%_WALK_UP){
	  BW_ANIMATION_REMOVE_OBJECT(PLAYER_OBJ)
	  If(%PLAYER_OBJ%_DIRECTION = "UP"){
		If(%PLAYER_OBJ%_SHOOT){
			BW_ANIAMTIONLIST_ADD("FAYT_WALK_UP_SHOOT",PLAYER_OBJ,false)     
		}else{
			BW_ANIAMTIONLIST_ADD("FAYT_WALK_UP",PLAYER_OBJ,false)     
		}
		  PHY_OBJECT_UPDATE(PLAYER_OBJ, "",  "",  "",  "","",-vector)
		%PLAYER_OBJ%_WALK_UP	:= true
	  }else{
		%PLAYER_OBJ%_DIRECTION    := "UP"
		BLOCKWORLD_OBJECT_TEXTURE_SET(PLAYER_OBJ, BW_TEXTURENAME_Fayt_Leingod_U_01)
		}	
	}
}else{
	  If(%PLAYER_OBJ%_WALK_UP){
		%PLAYER_OBJ%_WALK_UP	:= false
		PHY_OBJECT_UPDATE(PLAYER_OBJ, "",  "",  "",  "","",0)
		BW_ANIMATION_REMOVE_OBJECT(PLAYER_OBJ)
		BLOCKWORLD_OBJECT_TEXTURE_SET(PLAYER_OBJ, BW_TEXTURENAME_Fayt_Leingod_U_01) 
	  }
}
;###################################################################################

;###################################################################################
If(GetKeyState(LEFT,"P")){
	If(!%PLAYER_OBJ%_WALK_LEFT){
	  BW_ANIMATION_REMOVE_OBJECT(PLAYER_OBJ)
	  If(%PLAYER_OBJ%_DIRECTION = "LEFT"){
		If(%PLAYER_OBJ%_SHOOT){
			BW_ANIAMTIONLIST_ADD("FAYT_WALK_RIGHT_SHOOT",PLAYER_OBJ,false)     
		}else{
			BW_ANIAMTIONLIST_ADD("FAYT_WALK_RIGHT",PLAYER_OBJ,false)  
		}
		PHY_OBJECT_UPDATE(PLAYER_OBJ, "",  "",  "",  "",-vector)
		%PLAYER_OBJ%_WALK_LEFT	:= true
	  }else{
		%PLAYER_OBJ%_DIRECTION    := "LEFT"
		BLOCKWORLD_OBJECT_TEXTURE_SET(PLAYER_OBJ, BW_TEXTURENAME_Fayt_Leingod_R_01)
		}
	}
}else{
	  If(%PLAYER_OBJ%_WALK_LEFT){
		%PLAYER_OBJ%_WALK_LEFT	:= false
		PHY_OBJECT_UPDATE(PLAYER_OBJ, "",  "",  "",  "",0)
		BW_ANIMATION_REMOVE_OBJECT(PLAYER_OBJ)
		BLOCKWORLD_OBJECT_TEXTURE_SET(PLAYER_OBJ, BW_TEXTURENAME_Fayt_Leingod_R_01)
	  }
}
;###################################################################################

;###################################################################################
If(GetKeyState(RIGHT,"P")){
	If(!%PLAYER_OBJ%_WALK_RIGHT){
	  
	  BW_ANIMATION_REMOVE_OBJECT(PLAYER_OBJ)
	  If(%PLAYER_OBJ%_DIRECTION = "RIGHT"){
		If(%PLAYER_OBJ%_SHOOT){
			BW_ANIAMTIONLIST_ADD("FAYT_WALK_LEFT_SHOOT",PLAYER_OBJ,false)  
		}else{
			BW_ANIAMTIONLIST_ADD("FAYT_WALK_LEFT",PLAYER_OBJ,false)  
		}
		PHY_OBJECT_UPDATE(PLAYER_OBJ, "",  "",  "",  "",vector)
		%PLAYER_OBJ%_WALK_RIGHT	:= true
	  }else{
		%PLAYER_OBJ%_DIRECTION    := "RIGHT"
		BLOCKWORLD_OBJECT_TEXTURE_SET(PLAYER_OBJ, BW_TEXTURENAME_Fayt_Leingod_L_01)
		}  
	}	
}else{
	  If(%PLAYER_OBJ%_WALK_RIGHT){
		%PLAYER_OBJ%_WALK_RIGHT	:= false
		PHY_OBJECT_UPDATE(PLAYER_OBJ, "",  "",  "",  "",0)
		BW_ANIMATION_REMOVE_OBJECT(PLAYER_OBJ)
		BLOCKWORLD_OBJECT_TEXTURE_SET(PLAYER_OBJ, BW_TEXTURENAME_Fayt_Leingod_L_01)
	  }
}
;###################################################################################

;###################################################################################

If(GetKeyState(SHOOT,"P")){
	
	If(!%PLAYER_OBJ%_ALIVE){
		MSGBOX You cant shoot.... you are dead :D {%PLAYER_OBJ%}
		return
	}

	If(!(%PLAYER_OBJ%_WALK_UP) and !(%PLAYER_OBJ%_WALK_DOWN) and !(%PLAYER_OBJ%_WALK_RIGHT) and !(%PLAYER_OBJ%_WALK_LEFT)){
		If(%PLAYER_OBJ%_DIRECTION = "RIGHT"){
			BLOCKWORLD_OBJECT_TEXTURE_SET(PLAYER_OBJ, BW_TEXTURENAME_Fayt_Leingod_LS_01)
		}else if(%PLAYER_OBJ%_DIRECTION = "LEFT"){
			BLOCKWORLD_OBJECT_TEXTURE_SET(PLAYER_OBJ, BW_TEXTURENAME_Fayt_Leingod_RS_01)
		}else if(%PLAYER_OBJ%_DIRECTION = "UP"){
			BLOCKWORLD_OBJECT_TEXTURE_SET(PLAYER_OBJ, BW_TEXTURENAME_Fayt_Leingod_US_01)
		}else if(%PLAYER_OBJ%_DIRECTION = "DOWN"){
			BLOCKWORLD_OBJECT_TEXTURE_SET(PLAYER_OBJ, BW_TEXTURENAME_Fayt_Leingod_DS_01)
		}
	}


	%PLAYER_OBJ%_WALK_DOWN	:= 0
	%PLAYER_OBJ%_WALK_UP	:= 0
	%PLAYER_OBJ%_WALK_RIGHT	:= 0
	%PLAYER_OBJ%_WALK_LEFT	:= 0

	%PLAYER_OBJ%_SHOOT	:= true
	
	If(((A_TickCount - last_shoot_%PLAYER_OBJ%) > 200) OR (last_shoot_%PLAYER_OBJ% = "")){
		SHOOT(PLAYER_OBJ,%PLAYER_OBJ%_WEAPON,15)	
		last_shoot_%PLAYER_OBJ%    := A_TickCount
	}
}else{
		%PLAYER_OBJ%_SHOOT	:= false
}
;###################################################################################
}


e::
	PLAYER_SWITCH_WEAPON(BW_OBJ_PLAYER)
return
DELETE::
	PLAYER_SWITCH_WEAPON(BW_OBJ_PLAYER2)
return

PLAYER_SWITCH_WEAPON(PLAYER_OBJ){
global
	%PLAYER_OBJ%_WEAPON	:= %PLAYER_OBJ%_WEAPON = "WEAPON_ENERGIE_FIRE"  ? "WEAPON_ENERGIE_ANTI"  : "WEAPON_ENERGIE_FIRE"   ;WEAPON_ENERGIE_ANTI
}


w::
s::
a::
d::
space::
return
